package com.baizhi.controller;

import com.baizhi.entity.Feedback;
import com.baizhi.service.FeedbackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

@CrossOrigin
@RestController
@RequestMapping("feedback")
public class FeedbackController {

    @Resource
    FeedbackService feedbackService;

    private static final Logger log = LoggerFactory.getLogger(FeedbackController.class);

    @RequestMapping("queryAllPage")
    public HashMap<String, Object> queryAllPage(Integer page,Integer pageSize){

        log.info("当前页：{}",page);
        log.info("每页展示几条数据：{}",pageSize);

        HashMap<String, Object> map = feedbackService.queryAllPage(page, pageSize);
        return map;
    }

    @RequestMapping("delete")
    public HashMap<String, Object> delete(@RequestBody Feedback feedback){

        log.info("接收删除的数据：{}",feedback);

        HashMap<String, Object> map = feedbackService.delete(feedback);
        return map;
    }
}
